package com.clqteam.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
 * 通过供应商查询其提供的货物信息
 * @author Administrator LXG
 *
 */

import com.clqteam.service.SelectProductBySupllierService;
import com.clqteam.serviceimpl.SelectProductBySupllierServiceImpl;

import net.sf.json.JSONObject;
public class SelectProductBySupllierLXGController extends HttpServlet{
	
	SelectProductBySupllierService spss=new SelectProductBySupllierServiceImpl();
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
	doPost(req, resp);
}

@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		req.setCharacterEncoding("utf8");
		resp.setCharacterEncoding("utf8");
	    String s=req.getParameter("supId");
	    int supId=Integer.parseInt(s);
	    String pa=req.getParameter("page");
	    int page=Integer.parseInt(pa);
	    String row=req.getParameter("rows");
	    int rows=Integer.parseInt(row);
		JSONObject jo=spss.selectProductBySupID(supId, page, rows);
		PrintWriter pw=resp.getWriter();
		pw.write(jo.toString());
		pw.flush();
		pw.close();
	}
}
